<div class="main-content">
    <header>
				<!--<a href="<?php echo bu('admin/members/new'); ?>?id=<?php echo $_GET['member']; ?>" class="fr button button-gray">Add New User</a>-->
        <h2>
          Members -
          <?php
            switch($_GET['member'])
            {
              case 1: echo "School"; break;
              case 2: echo "CEC Communities"; break;
              case 3: echo "SELC Communities"; break;
            }
          ?>
        </h2>
    </header>

    <section>
      <?php echo $this->renderPartial('/partials/_notifications'); ?>
      <h3>Approved Members</h3>
			<table class="datatable paginate sortable full">
				<thead>
				<tr>
					<th>Name</th>
					<th>Email</th>
					<th>Approved?</th>
					<th>Join Date</th>
					<th>Modified Date</th>
					<th style="width:70px"></th>
				</tr>
				</thead>
				<tbody>
				<?php foreach ($members as $member){ ?>
        <?php if($member->status == Users::STATUS_APPROVED){ ?>
				<tr>
					<td align="center"><a href="<?php echo bu('admin/users/schoolmember?id='.$member->id); ?>"><?php echo $member->name; ?></a></td>
					<td align="center" style="word-wrap:break-word;"><?php echo $member->email; ?></td>
					<td align="center">
            <img src="<?php echo bu('images/accept.png'); ?>" title="Approved" />
          </td>
          <td align="center"><?php echo Helpers::customDate($member->created_at); ?></td>
          <td align="center"><?php echo Helpers::customDate($member->modified_at); ?></td>
					<td>
					<ul class="action-buttons">
            <?php if($member->status == Users::STATUS_APPROVED){ ?>
              <li><a href="<?php echo bu('admin/users/decline?member='.$member->id) ?>" class="button button-gray no-text" title="Decline this membership">Decline this membership<span class="decline"></span></a></li>
            <?php }else{ ?>
              <li><a href="<?php echo bu('admin/users/approve?member='.$member->id) ?>" class="button button-gray no-text" title="Approved this membership">Approved this membership<span class="accept"></span></a></li>
            <?php } ?>
						<li><a href="<?php echo bu('admin/members/delete'); ?>?id=<?php echo $member->id; ?>" method="POST" class="button button-gray no-text"><span class="bin"></span>Delete</a></li>
					</ul>
					</td>
				</tr>
				<?php }} ?>
				</tbody>
			</table><br />

      <h3>Disapproved Members</h3>
			<table class="datatable paginate sortable full">
				<thead>
				<tr>
					<th>Name</th>
					<th>Email</th>
					<th>Approved?</th>
					<th>Join Date</th>
					<th>Modified Date</th>
					<th style="width:70px"></th>
				</tr>
				</thead>
				<tbody>
				<?php foreach ($members as $member){ ?>
        <?php if($member->status == Users::STATUS_REJECT){ ?>
				<tr>
					<td align="center"><a href="<?php echo bu('admin/users/schoolmember?id='.$member->id); ?>"><?php echo $member->name; ?></a></td>
					<td align="center" style="word-wrap:break-word;"><?php echo $member->email; ?></td>
					<td align="center">
            <img src="<?php echo bu('images/cross.png'); ?>" title="Approved" />
          </td>
          <td align="center"><?php echo Helpers::customDate($member->created_at); ?></td>
          <td align="center"><?php echo Helpers::customDate($member->modified_at); ?></td>
					<td>
					<ul class="action-buttons">
            <?php if($member->status == Users::STATUS_APPROVED){ ?>
              <li><a href="<?php echo bu('admin/users/decline?member='.$member->id) ?>" class="button button-gray no-text" title="Decline this membership">Decline this membership<span class="decline"></span></a></li>
            <?php }else{ ?>
              <li><a href="<?php echo bu('admin/users/approve?member='.$member->id) ?>" class="button button-gray no-text" title="Approved this membership">Approved this membership<span class="accept"></span></a></li>
            <?php } ?>
						<li><a href="<?php echo bu('admin/members/delete'); ?>?id=<?php echo $member->id; ?>" method="POST" class="button button-gray no-text"><span class="bin"></span>Delete</a></li>
					</ul>
					</td>
				</tr>
				<?php }} ?>
				</tbody>
			</table><br />

      <h3>Pending Members</h3>
			<table class="datatable paginate sortable full">
				<thead>
				<tr>
					<th>Name</th>
					<th>Email</th>
					<th>Approved?</th>
					<th>Join Date</th>
					<th>Modified Date</th>
					<th style="width:70px"></th>
				</tr>
				</thead>
				<tbody>
				<?php foreach ($members as $member){ ?>
        <?php if($member->status == Users::STATUS_PENDING){ ?>
				<tr>
					<td align="center"><a href="<?php echo bu('admin/users/schoolmember?id='.$member->id); ?>"><?php echo $member->name; ?></a></td>
					<td align="center" style="word-wrap:break-word;"><?php echo $member->email; ?></td>
					<td align="center">
            <img src="<?php echo bu('images/cross.png'); ?>" title="Not yet approved" />
          </td>
          <td align="center"><?php echo Helpers::customDate($member->created_at); ?></td>
          <td align="center"><?php echo Helpers::customDate($member->modified_at); ?></td>
					<td>
					<ul class="action-buttons">
            <?php if($member->status == Users::STATUS_APPROVED){ ?>
              <li><a href="<?php echo bu('admin/users/decline?member='.$member->id) ?>" class="button button-gray no-text" title="Decline this membership">Decline this membership<span class="decline"></span></a></li>
            <?php }else{ ?>
              <li><a href="<?php echo bu('admin/users/approve?member='.$member->id) ?>" class="button button-gray no-text" title="Approved this membership">Approved this membership<span class="accept"></span></a></li>
            <?php } ?>
						<li><a href="<?php echo bu('admin/members/delete'); ?>?id=<?php echo $member->id; ?>" method="POST" class="button button-gray no-text"><span class="bin"></span>Delete</a></li>
					</ul>
					</td>
				</tr>
				<?php }} ?>
				</tbody>
			</table><br />

      <h3>Inactive Members</h3>
			<table class="datatable paginate sortable full">
				<thead>
				<tr>
					<th>Name</th>
					<th>Email</th>
					<th>Approved?</th>
					<th>Join Date</th>
					<th>Modified Date</th>
					<th style="width:70px"></th>
				</tr>
				</thead>
				<tbody>
				<?php foreach ($members as $member){ ?>
        <?php if($member->status == Users::STATUS_INACTIVE){ ?>
				<tr>
					<td align="center"><a href="<?php echo bu('admin/users/schoolmember?id='.$member->id); ?>"><?php echo $member->name; ?></a></td>
					<td align="center" style="word-wrap:break-word;"><?php echo $member->email; ?></td>
					<td align="center">
            <img src="<?php echo bu('images/icons/inactive-icons.gif'); ?>" title="Inactive member" />
          </td>
          <td align="center"><?php echo Helpers::customDate($member->created_at); ?></td>
          <td align="center"><?php echo Helpers::customDate($member->modified_at); ?></td>
					<td>
					<ul class="action-buttons">
            <?php if($member->status == Users::STATUS_APPROVED){ ?>
              <li><a href="<?php echo bu('admin/users/decline?member='.$member->id) ?>" class="button button-gray no-text" title="Decline this membership">Decline this membership<span class="decline"></span></a></li>
            <?php }else{ ?>
              <li><a href="<?php echo bu('admin/users/approve?member='.$member->id) ?>" class="button button-gray no-text" title="Approved this membership">Approved this membership<span class="accept"></span></a></li>
            <?php } ?>
						<li><a href="<?php echo bu('admin/members/delete'); ?>?id=<?php echo $member->id; ?>" method="POST" class="button button-gray no-text"><span class="bin"></span>Delete</a></li>
					</ul>
					</td>
				</tr>
				<?php }} ?>
				</tbody>
			</table><br />
      
      <h3>Awaiting Renewal</h3>
			<table class="datatable paginate sortable full">
				<thead>
				<tr>
					<th>Name</th>
					<th>Email</th>
					<th>Created At</th>
					<th style="width:70px"></th>
				</tr>
				</thead>
				<tbody>
				<?php foreach ($invoices as $invoice){ ?>
				<tr>
					<td align="center"><a href="<?php echo bu('admin/users/schoolmember?id='.$invoice->user_id); ?>"><?php echo $invoice->user->name; ?></a></td>
					<td align="center" style="word-wrap:break-word;"><?php echo $invoice->user->email; ?></td>
          <td align="center"><?php echo Helpers::customDate($invoice->created_at); ?></td>
					<td>
					<ul class="action-buttons">
            <li><a href="<?php echo bu('admin/invoices/approve?id='.$invoice->id.'&&member='.$invoice->user->member_id) ?>" class="button button-gray no-text" title="Approved this membership">Approved this membership<span class="accept"></span></a></li>
					</ul>
					</td>
				</tr>
				<?php } ?>
				</tbody>
			</table>
    </section>

</div>